package com.hzw.code.common.constant;

import com.hzw.code.common.utils.ActionResult;
import com.hzw.code.common.utils.ResultCodeEnum;

/**
 * 父类控制器
 */
public class SuperController {

    public static <T> ActionResult<T> successMsg(String msg) {
        return new ActionResult<>(ResultCodeEnum.SUCCESS, msg, null);
    }

    public static <T> ActionResult<T> successData(T data) {
        return new ActionResult<>(ResultCodeEnum.SUCCESS, null, data);
    }

    public static <T> ActionResult<T> success(String msg, T model) {
        return new ActionResult<>(ResultCodeEnum.SUCCESS, msg, model);
    }

    public static <T> ActionResult<T> success() {
        return new ActionResult<>(ResultCodeEnum.SUCCESS);
    }

    public static <T> ActionResult<T> error(ResultCodeEnum code, String msg, T model) {
        return new ActionResult<>(code, msg, model);
    }

    public static <T> ActionResult<T> error(ResultCodeEnum code, String msg) {
        return new ActionResult<>(code, msg);
    }

    public static <T> ActionResult<T> error(String msg, T model) {
        return new ActionResult<>(ResultCodeEnum.ERROR_DEFAULT, msg, model);
    }

    public static <T> ActionResult<T> error(ResultCodeEnum code) {
        return new ActionResult<>(code);
    }

    public static <T> ActionResult<T> error(String msg) {
        return new ActionResult<>(ResultCodeEnum.ERROR_DEFAULT, msg, null);
    }

    public static <T> ActionResult<T> error() {
        return new ActionResult<>(ResultCodeEnum.ERROR_DEFAULT);
    }

}
